# from day09.api.hm01_add import add
#
# # unittest 框架
# import unittest
# # 导包
# class TestSd(unittest.TestCase):
#     # 定义测试类
#     def test01_sd(self):
#         result = add(1,2)
#         # 定义方法
# # 然后调用函数
#
# suite = unittest.TestSuite()
# # 实例化测试套件对象
# suite.addTest(TestSd(test01_sd))
# suite.addTest(Testsd(test01_sd))
# # 添加测试用例
# # 添加整个类的测试用例
# suite.addTest(unittest.makeSuite(TestSd))
# suite.addTest(unittest.makeSuite(TestSd))
# 定义函数
# num = 100
# # 外部变量
# def info():
#     print(f'变量为{num}')
# def info1():
#     global num
#     # 修改变量值
#     num = 200
#     print(num)
# # 调用函数
# info()
# info1()
# def person_info():
# #     name =
# def demo(num,*args):
#     print(num)
#     print(args)
# demo(1)
# demo(1,2,3,4)
# def demo(*args):
#     result = 0
#     for i in args:
#         result += i
#         i += 1
#     print(result)
# num = (1,2,3)
# demo(*num)
# result = lambda a,b:a+b
# print(result(1,3))
# user_list = [{'name': '张三', 'age': 22, 'title': '测试工程师'},
#              {'name': '李四', 'age': 24, 'title': '开发工程师'},
#              {'name': '王五', 'age': 21, 'title': '测试工程师'}]
# info = lambda a:a['age']
# user_list.sort(key=info,reverse=True)
# print(user_list)
# def input_info():
#     name = input('请输入姓名')
#     age = input('请输入年龄')
#     stu_info = {"name":name,"age":age}
#     return stu_info
# list_info = []
# for i in range(3):
#     data = input_info()
#     list_info.append(data)
# print(list_info)
# def print_info():
#     # 定义函数
#     print('-----学生列表信息-----')
#     num = 1
#     for i in list_info:
#         print(f'{num} {i.get("name")}  {i.get("age")}')
#         num += 1
# print_info()
# # 调用函数
# def count_info():
#     # 定义函数
#     print(len(list_info))
# count_info()
# # 调用函数
# print(count_info())
#
# def find_info():
#     # 查询学生信息
#     find_name = input('请输入需要查询的学生姓名')
#     for i in list_info:
#         if find_name == i.get("name"):
#             print(f'学生姓名:{i.get("name")}年龄:{i.get("age")}')
#             return
#        # 如果发现这个学生姓名直接结束,如果错误可以直接打印错误提示
#     print(f'对不起{find_name}不存在')
# find_info()
# list = []
# for i in range(3):
#     name = input('输入水果名称:')
#     price = input('输入水果价格')
#     info = {"name":name,"price":price}
#     list.append(info)
# print(list)
# def fruits_info():
#     num = 1
#     for n in list:
#         print(f'{num}  {n.get("name")}  {n.get("price")}')
#         num += 1
# fruits_info()




